home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC04Cust.Ctrl / BC.DProc.asm1 next >
Encoding:
Text File  |  1990-06-24  |  24.4 KB  |  652 lines  |  [TEXT/pdos]

  1. *******************************************************************************
  2. *
  3. * BoxCtl CDEFProc -- Version 3.0
  4. *
  5. * (C)  Copyright Apple Computer, Inc. 1988-1990
  6. * All rights reserved.
  7. *
  8. * Developer Technical Support Apple II Sample Code
  9. *
  10. * by Keith Rollin
  11. *
  12. * This is a Custom Control for the Apple IIGS. It is similar in appearance
  13. * and action to the 'resize' box you get when clicking on an object in GS Draw
  14. * or MacDraw.
  15. *
  16. * The Control is essentially a frame with 4 or 8 grow knobs on the corners
  17. * and/or edges. Dragging on any of these knobs will grow the control. Dragging
  18. * on the frame will move the entire control (like moving a window). A flag can
  19. * be set so that the control will be dragged if the user clicks in the interior
  20. * of the control as well. Part codes for the knobs and frame are listed below.
  21. *
  22. * Snapping the rectangle's coordinates to a grid is also supported. The
  23. * rectangle is snapped to the nearest point on the grid. This effectively means
  24. * that I perform rounding, and not truncating.
  25. *
  26. * The frame of the control is the rectangle passed to NewControl. The size of
  27. * the knobs and the size of the grid are passed in ctlValue. The 'interior drag
  28. * flag' is passed in ctlFlags. See below for details.
  29. *
  30. * Color is supported. Currently, only two colors are used: one for the frame,
  31. * and one for the knobs. The default colors are black.
  32. *
  33. *******************************************************************************
  34. *
  35. *   Part Code returned:
  36. *
  37. *           $A0 for all parts of the control (all parts are 'indicators')
  38. *
  39. *
  40. *   CtlValue:   Bits  8-15: width of grow knobs
  41. *               Bits  0- 7: height of grow knobs
  42. *
  43. *   CtlFlag bits:
  44. *               7 = 1 - Control is invisible
  45. *                 = 0 - Control is visible
  46. *               2 = 1 - Has edge knobs
  47. *                 = 0 - Doesn't
  48. *               1 = 1 - Has corner knobs
  49. *                 = 0 - Doesn't
  50. *               0 = 1 - Clicking in interior will drag control
  51. *                 = 0 - Clicking in interior does nothing
  52. *
  53. *   Data:   Contains a pointer to the following data block. This data
  54. *           block holds the following information, which is copied to
  55. *           the end of the control record:
  56. *
  57. *               WORD: Min Y when growing
  58. *               WORD: Min X when growing
  59. *               WORD: Max Y when growing
  60. *               WORD: Max X when growing
  61. *               WORD: Spacing for Y segment of grid
  62. *               WORD: Spacing for X segment of grid
  63. *
  64. *   Color Table:
  65. *       WORD: Bits  12-15:  <reserved>
  66. *                    8-11:  Knob Color
  67. *                    4- 7:  Inactive Frame/Knob Color
  68. *                    0- 3:  Frame Color
  69. *
  70. *******************************************************************************
  71. *
  72. *   How to use the Control:
  73. *
  74. *       Initialization and tracking of the control work just like any other;
  75. *       set it up with NewControl. When GetNextEvent returns inContent, call
  76. *       FindControl to see if you hit the control. If you did, call
  77. *       TrackControl.
  78. *
  79. *   Initialization:
  80. *
  81. *               pha                     ; space for result
  82. *               pha
  83. *               PushLong theWindow
  84. *               PushLong #theRect       ; pointer to bounding rectangle
  85. *               PushLong #0             ; no title
  86. *               PushWord #%00000111     ; vis, int will drag, corners & edges
  87. *               PushWord #$0503         ; Width = 5/Height = 3
  88. *               PushLong #CtrlData      ; Pointer to additional data
  89. *               PushLong #BoxProc       ; pointer to DefProc
  90. *               PushLong #0             ; refcon
  91. *               PushLong #0             ; use std color table
  92. *               _NewControl
  93. *               PullLong theControl
  94. *
  95. *   theRect     dc i2''   50,140,110,300
  96. *   CtrlData    dc i2''   10      ; min Y
  97. *               dc i2''   10      ; min X
  98. *               dc i2''   100     ; max Y
  99. *               dc i2''   200     ; max X
  100. *               dc i2''   16      ; grid Y
  101. *               dc i2''   32      ; grid X
  102. *
  103. *******************************************************************************
  104. **********************************************************************
  105. *                                                                    *
  106. *             Apple IIGS Source Code Sampler, Volume I               *
  107. *                                                                    *
  108. *             Copyright (c) Apple Computer, Inc. 1988                *
  109. *                       All Rights Reserved                          *
  110. *                                                                    *
  111. *            Written by Apple II Developer Tech Support              *
  112. *                                                                    *
  113. *                                                                    *
  114. *                                                                    *
  115. *  ----------------------------------------------------------------  *
  116. *                                                                    *
  117. *     This program and its derivatives are licensed only for         *
  118. *     use on Apple computers.                                        *
  119. *                                                                    *
  120. *     Works based on this program must contain and                   *
  121. *     conspicuously display this notice.                             *
  122. *                                                                    *
  123. *     This software is provided for your evaluation and to           *
  124. *     assist you in developing software for the Apple IIGS           *
  125. *     computer.                                                      *
  126. *                                                                    *
  127. *     DISCLAIMER OF WARRANTY                                         *
  128. *                                                                    *
  129. *     THE SOFTWARE IS PROVIDED "AS IS" WITHOUT                       *
  130. *     WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,               *
  131. *     WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS             *
  132. *     FOR ANY PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO             *
  133. *     THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH            *
  134. *     YOU.  SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND            *
  135. *     NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE)               *
  136. *     ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING,             *
  137. *     REPAIR OR CORRECTION.                                          *
  138. *                                                                    *
  139. *     Apple does not warrant that the functions                      *
  140. *     contained in the Software will meet your requirements          *
  141. *     or that the operation of the Software will be                  *
  142. *     uninterrupted or error free or that defects in the             *
  143. *     Software will be corrected.                                    *
  144. *                                                                    *
  145. *     SOME STATES DO NOT ALLOW THE EXCLUSION                         *
  146. *     OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY              *
  147. *     NOT APPLY TO YOU.  THIS WARRANTY GIVES YOU SPECIFIC            *
  148. *     LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS                *
  149. *     WHICH VARY FROM STATE TO STATE.                                *
  150. *                                                                    *
  151. *                                                                    *
  152. **********************************************************************
  153.                     eject
  154. ;-------------------------------------------
  155. ;
  156. ; --- Constants
  157. ;
  158. ; --- Stack Frame/Local Direct Page usage
  159. ;
  160.  
  161. OrigD               gequ 1               ; caller's saved direct page register
  162. OrigB               gequ OrigD+2         ; caller's saved data bank register
  163. work                gequ OrigB+1         ; general use work space
  164. CtlPtr              gequ work+4          ; pointer to control record
  165. RtnAddr             gequ CtlPtr+4        ; RTL address back to Control Manager
  166. theCtlHandle        gequ RtnAddr+3       ; handle to control record
  167. CtlParam            gequ theCtlHandle+4  ; add'l parameter passed to DefProc
  168. CtlCode             gequ CtlParam+4      ; operation to perform
  169. ReturnValue         gequ CtlCode+2       ; space for return value to Ctl Mgr.
  170.  
  171. ;
  172. ; --- Offsets for my control record
  173. ;
  174.  
  175. oCtlMinY            gequ octlColor+4
  176. oCtlMinX            gequ oCtlMinY+2
  177. oCtlMaxY            gequ oCtlMinX+2
  178. oCtlMaxX            gequ oCtlMaxY+2
  179. oCtlGridY           gequ oCtlMaxX+2
  180. oCtlGridX           gequ oCtlGridY+2
  181. oCtlSize            gequ oCtlGridX+2
  182.  
  183. ;
  184. ; --- Part codes for my control
  185. ;
  186.  
  187. BoxCtlPart          gequ $A0             ; This is returned to the app.
  188.  
  189. FramePart           gequ $01             ; These are used internally to tell
  190. InteriorPart        gequ $02             ; 'myDragCtl' what part of the
  191. ULPart              gequ $03             ; control we are dragging.
  192. TopPart             gequ $04
  193. URPart              gequ $05
  194. RightPart           gequ $06
  195. LLPart              gequ $07
  196. BottomPart          gequ $08
  197. LRPart              gequ $09
  198. LeftPart            gequ $0A
  199.  
  200.  
  201. ;
  202. ; --- Masks for ctlFlags
  203. ;
  204.  
  205. dragIntMask         gequ %00000001       ; if set, let user drag on interior
  206. knobCornerMask      gequ %00000010       ; if set, draw knobs on the corners
  207. knobEdgeMask        gequ %00000100       ; if set, draw knobs on the edges
  208. visMask             gequ ctlInVis
  209.  
  210.                     EJECT
  211. *******************************************************************************
  212. *
  213. CtlData             data
  214. *
  215. * Description:      Storage for CDEF
  216. *
  217. *
  218. * External Refs:    NONE
  219. *
  220. * Entry Points:     NONE
  221. *
  222. *******************************************************************************
  223.  
  224. deltaX              ds 2                ; used when growing the control
  225. deltaY              ds 2
  226. ColorPtr            ds 4                ; pointer to actual color table to use
  227. theParam            ds 4                ; copy of CtlParam passed on stack
  228. dragPart            ds 2                ; internal part of control hit
  229.  
  230. myCtlRect           ds 8                ; copy of CtlRect in control record
  231. myCtlGridY          ds 2                ; copy of CtlGridY
  232. myCtlGridX          ds 2                ; copy of CtlGridX
  233.  
  234. FrameHeight         ds 2
  235. FrameWidth          ds 2
  236.  
  237. knobUL              ds 8                ; This space is used to store the
  238. knobTop             ds 8                ; rectangles that define the grow
  239. knobUR              ds 8                ; knobs on the control. They are
  240. knobRight           ds 8                ; created as needed, and are not
  241. knobLR              ds 8                ; stored in the control record.
  242. knobBottom          ds 8
  243. knobLL              ds 8
  244. knobLeft            ds 8
  245.  
  246. StdColorTable       dc i1'$C0'          ; grey inact frame, blk normal frame
  247.                     dc i1'$00'          ; black knobs
  248. StdCtlData          dc i2'10,10,200,640,0,0' ; min 10,10; max 200,640; no grid
  249. oldPenState         ds $32              ; storage for old pen state.
  250.  
  251. GreyPattern         dc i1'$CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC'
  252.                     dc i1'$CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC'
  253.                     dc i1'$CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC'
  254.                     dc i1'$CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC'
  255.  
  256.                     end
  257.  
  258.                     EJECT
  259. *******************************************************************************
  260. *
  261. BoxProc             start
  262. *
  263. * Description:      Main Routine for Custom Control.
  264. *
  265. *
  266. * Inputs:           On entry, the parameters are passed to us on the stack.
  267. *
  268. *                   |                   | Previous Contents
  269. *                   |-------------------|
  270. *                   |    ReturnValue    | LONG - Space for return value
  271. *                   |-------------------|
  272. *                   |    CtlCode        | WORD - operation to perform
  273. *                   |-------------------|
  274. *                   |    CtlParam       | LONG - add'l parameter
  275. *                   |-------------------|
  276. *                   |    theCtlHandle   | LONG - Handle to control record
  277. *                   |-------------------|
  278. *                   |    RtnAddr        | 3 BYTES - RTL address
  279. *                   |-------------------|
  280. *                   |                   | <-- Stack pointer
  281. *
  282. * Outputs:          Put something into ReturnValue, pull off the parameters,
  283. *                   and return to the Control Manager.
  284. *
  285. *                   |                   | Previous Contents
  286. *                   |-------------------|
  287. *                   |    ReturnValue    | LONG - Space for return value
  288. *                   |-------------------|
  289. *                   |    RtnAddr        | 3 BYTES - RTL address
  290. *                   |-------------------|
  291. *                   |                   | <-- Stack pointer
  292. *
  293. * External Refs:
  294. *                   Import InitCtlData
  295. *                   Import myDrawCtl
  296. *                   Import myTestCtl
  297. *                   Import myInitCtl
  298. *                   Import myDragCtl
  299. *                   Import myNewValue
  300. *                   Import mySetParams
  301. *                   Import myRecSize
  302. *                   Import Null
  303. *
  304. * Entry Points:     NONE
  305. *
  306. *******************************************************************************
  307.                     using CtlData
  308.  
  309. ;
  310. ; We are going to be using the stack as our direct page for the
  311. ; custom control. The equates listed at the beginning of the custom
  312. ; control (right after the pageful of comments that explain it)
  313. ; describe the layout of the stack frame.
  314. ;
  315. ; The way we set up the stack frame as our direct page is by first
  316. ; saving the old contents of the DP register, transfering the stack
  317. ; pointer to the accumulator, and then transferring that to the DP
  318. ; register. We also save the contents of the Data Bank Register and
  319. ; reset it to the Program Bank Register so that we don't have to
  320. ; use 3-byte long addressing anywhere. We will restore both of these
  321. ; registers when we leave the custom control.
  322. ;
  323.  
  324.                     pha                 ; push on some room for 'CtlPtr'
  325.                     pha
  326.                     pha                 ; push on some room for 'work'
  327.                     pha
  328.  
  329.                     phb                 ; save the Data Bank register
  330.                     phd                 ; save the Direct Page register
  331.  
  332.                     phk                 ; switch data bank to program bank
  333.                     plb
  334.                     tsc                 ; switch Direct Page into stack
  335.                     tcd
  336.  
  337.                     jsr InitCtlData     ; init some handy data
  338.  
  339.                     lda <CtlCode        ; get routine # to call
  340.                     cmp #recSize+1      ; we only know of 12 CtlCodes
  341.                     blt ShiftIt
  342.                     lda #6              ; force unknown codes to null events
  343. ShiftIt             ANOP
  344.                     asl a
  345.                     tax
  346.                     jsr (CtlTable,x)
  347.  
  348.                     sta <ReturnValue    ; save the return value
  349.                     stx <ReturnValue+2
  350.  
  351. ;
  352. ; The Return Value has been stored on the stack, and it is time for us to
  353. ; return back to the Control Manager. Before we do so, however, we must
  354. ; remove the parameters that were passed to us on the stack. We do this
  355. ; by moving the RTL address up just below the Return Value, getting the
  356. ; stack pointer, and adding an amount to it so that we point to where
  357. ; the RTL address has been moved to. We can then simply RTL back to the
  358. ; Control Manager, and it will pick up the Return Value right off of the
  359. ; stack!
  360. ;
  361.                     lda <RtnAddr        ; move the return address up
  362.                     sta <ReturnValue-3
  363.                     lda <RtnAddr+1
  364.                     sta <ReturnValue-2
  365.  
  366.                     tsc                 ; Get the stack pointer
  367.  
  368.                     pld                 ; restore caller's Data Bank and
  369.                     plb                 ; Direct Page registers
  370.  
  371.                     clc                 ; Adjust the stack pointer to point to
  372.                     adc #ReturnValue-4  ; the new location of the RTL address.
  373.                     tcs                 ; Put the stack pointer back.
  374.  
  375.                     rtl                 ; back to the caller
  376.  
  377.  
  378. ; This is a table of pointers to routines to be called for specific
  379. ; CtlCodes passed to us. The 'null' entries are pointers to a
  380. ; routine that does nothing except return 'no error'.
  381.  
  382. CtlTable            ANOP
  383.                     dc i2'myDrawCtl'    ; 0 drawCtl
  384.                     dc i2'Null'         ; 1 calcCRect
  385.                     dc i2'myTestCtl'    ; 2 testCtl
  386.                     dc i2'myInitCtl'    ; 3 initCtl
  387.                     dc i2'Null'         ; 4 dispCtl
  388.                     dc i2'Null'         ; 5 posCtl
  389.                     dc i2'Null'         ; 6 thumbCtl
  390.                     dc i2'myDragCtl'    ; 7 dragCtl
  391.                     dc i2'Null'         ; 8 autoTrack
  392.                     dc i2'myNewValue'   ; 9 newValue
  393.                     dc i2'mySetParams'  ;10 setParams
  394.                     dc i2'myInitCtl'    ;11 moveCtl
  395.                     dc i2'myRecSize'    ;12 recSize
  396.  
  397.                     end
  398.  
  399.                     EJECT
  400. *******************************************************************************
  401. *
  402. myDrawCtl           start
  403. *
  404. * Description:      Draw control command.
  405. *
  406. *
  407. * Inputs:           NONE
  408. *
  409. * Outputs:          NONE
  410. *
  411. * External Refs:
  412. *                   Import CalcCorners
  413. *                   Import SetMyPen
  414. *
  415. * Entry Points:     NONE
  416. *
  417. *******************************************************************************
  418.                     using CtlData
  419.  
  420. ; figure out the coordinates of the grow knobs.
  421.  
  422.                     jsr CalcCorners
  423.  
  424. ; Save the pen state, as we'll be changing it a lot.
  425.  
  426.                     PushLong #oldPenState
  427.                     _GetPenState
  428.  
  429. ; Set the correct width of the pen for the mode we are in.
  430.  
  431.                     jsr SetMyPen
  432.  
  433. ;
  434. ; Set the local variable 'ActivFlag' to indicate how to draw the
  435. ; control. We draw it inactive if a) the Hilite value is 255, or b)
  436. ; the owner window is inactive and fCtrlTie is set.
  437. ;
  438.                     ldy #octlHilite     ; are we inactive?
  439.                     lda [<CtlPtr],y
  440.                     and #$00FF
  441.                     cmp #$00FF
  442.                     beq DrawInactive    ; yes, so clear ActivFlag
  443.  
  444. ; At this point, the control can potentially be drawn as an active
  445. ; control. But this can only happen if the window is active, or is
  446. ; inactive but with the fCtlTie flag clear.
  447.  
  448.                     ldy #octlOwner      ; get the pointer to the control's
  449.                     lda [<CtlPtr],y     ; owning window into 'work'
  450.                     sta <work
  451.                     iny
  452.                     iny
  453.                     lda [<CtlPtr],y
  454.                     sta <work+2
  455.  
  456.                     ldy #owFrame-4      ; get the frame bits
  457.                     lda [<work],y
  458.                     and #fHilited       ; check the Hilite bit
  459.                     bne DrawActive      ; window is active -> control active
  460.                     lda [<work],y       ; window is inactive
  461.                     and #fCtlTie        ; does CtlTie bit affect control?
  462.                     bne DrawInactive    ; yes, so draw it inactive too
  463.  
  464. DrawActive          lda #1
  465.                     sta ActivFlag
  466.                     bra SetColorTable
  467.  
  468. DrawInactive        stz ActivFlag
  469.  
  470. ; Put the color table pointer into a  Direct page location.
  471.  
  472. SetColorTable       ANOP
  473.                     lda ColorPtr
  474.                     sta <work
  475.                     lda ColorPtr+2
  476.                     sta <work+2
  477.  
  478. ;
  479. ; See if the control is active or not, and set the color
  480. ; accordingly.
  481. ;
  482.  
  483.                     lda ActivFlag
  484.                     bne SetFrameColor
  485.  
  486.                     lda [<work]         ; YES - so we are. Use the inactive
  487.                     lsr a               ; pattern for this.
  488.                     lsr a
  489.                     lsr a
  490.                     lsr a
  491.                     and #$000f
  492.                     pha
  493.                     _SetSolidPenPat
  494.  
  495.                     bra DrawFrame
  496.  
  497. SetFrameColor       ANOP
  498.                     lda [<work]         ; get the color for the frame from
  499.                     and #$000f          ; the color table and use it.
  500.                     pha
  501.                     _SetSolidPenPat
  502.  
  503. DrawFrame           ANOP
  504.                     PushLong #myCtlRect ; draw the frame of the control
  505.                     _FrameRect
  506.  
  507. ;
  508. ; See if the control is active or not, and set the color accordingly. If
  509. ; we so chose we could even decide not to draw knobs on an inactive sizer.
  510. ; This is similar to the scrollbar defproc no drawing the thumb on an
  511. ; inactive scrollbar.
  512. ;
  513.  
  514.                     lda ActivFlag
  515.                     beq DrawKnobs       ; it's inactive; keep that pattern
  516.  
  517.                     lda [<work]         ; get the color of the knobs from
  518.                     xba                 ; the color table and set it.
  519.                     and #$000f
  520.                     pha
  521.                     _SetSolidPenPat
  522.  
  523. DrawKnobs           ANOP
  524.                     ldy #octlFlag       ; do we need corner knobs?
  525.                     lda [<CtlPtr],y
  526.                     and #knobCornerMask
  527.                     beq ckEdges         ; no, so check for edge knobs.
  528.  
  529.                     PushLong #knobUL    ; yes, so draw them
  530.                     _PaintRect
  531.  
  532.                     PushLong #knobUR
  533.                     _PaintRect
  534.  
  535.                     PushLong #knobLL
  536.                     _PaintRect
  537.  
  538.                     PushLong #knobLR
  539.                     _PaintRect
  540.  
  541. ckEdges             ANOP
  542.                     ldy #octlFlag       ; do we need edge knobs?
  543.                     lda [<CtlPtr],y
  544.                     and #knobEdgeMask
  545.                     beq done            ; no, so leave
  546.  
  547.                     PushLong #knobTop   ; yes, so draw them.
  548.                     _PaintRect
  549.  
  550.                     PushLong #knobRight
  551.                     _PaintRect
  552.  
  553.                     PushLong #knobBottom
  554.                     _PaintRect
  555.  
  556.                     PushLong #knobLeft
  557.                     _PaintRect
  558.  
  559. done                ANOP
  560.                     PushLong #oldPenState ; clean up after ourselves.
  561.                     _SetPenState
  562.  
  563.                     lda #0
  564.                     tax
  565.  
  566.                     rts
  567.  
  568. ActivFlag           ds 2
  569.  
  570.                     end
  571.  
  572.                     EJECT
  573. *******************************************************************************
  574. *
  575. myTestCtl           start
  576. *
  577. * Description:      Hit test command. This routine checks to see if we have
  578. *                   chosen the ability to drag the control when we click in
  579. *                   the interior or not. If so, then we will always return
  580. *                   our partcode (BoxCtlPart = $A0). If not, then we only
  581. *                   return our partcode if we click on the frame or a knob.
  582. *
  583. *
  584. * Inputs:           NONE
  585. *
  586. * Outputs:          A = Part code hit
  587. *
  588. * External Refs:
  589. *                   Import TestFrame
  590. *
  591. * Entry Points:     NONE
  592. *
  593. *******************************************************************************
  594.                     using CtlData
  595.  
  596.                     jsr TestFrame
  597.                     cmp #noPart         ; hit anything?
  598.                     beq exit            ; no - return nothing
  599.                     lda #BoxCtlPart     ; yes - return our partcode
  600. exit                ANOP
  601.                     ldx #0              ; high byte of return value always $00
  602.                     rts
  603.  
  604.                     end
  605.  
  606.                     EJECT
  607. *******************************************************************************
  608. *
  609. myInitCtl           start
  610. *
  611. * Description:      Called to initialize my custom fields of the control
  612. *                   data. It calles mySetParams to handle the data that
  613. *                   is pointed to by the Data/Params field, and makes sure
  614. *                   that the corners of the rectangle lie on the grid.
  615. *
  616. *
  617. * Inputs:           NONE
  618. *
  619. * Outputs:          NONE
  620. *
  621. * External Refs:
  622. *                   Import mySetParams
  623. *                   Import Snap2Grid
  624. *                   Import SetCtlRect
  625. *                   Import InitCtlData
  626. *
  627. * Entry Points:     NONE
  628. *
  629. *******************************************************************************
  630.                     using CtlData
  631.  
  632. ; First, set up some fields based on the value of Param. This is
  633. ; a pointer to some additional data, so what SetParams does is
  634. ; copy that into our control record.
  635.  
  636.                     jsr mySetParams
  637.                     jsr InitCtlData
  638.  
  639. ; Next, make sure the edges of the control are aligned to a grid.
  640.  
  641.                     ldx #^myCtlRect
  642.                     lda #myCtlRect
  643.                     jsr Snap2Grid
  644.  
  645.                     jsr SetCtlRect
  646.  
  647.                     lda #0              ; return nothing
  648.                     txa
  649.  
  650.                     rts
  651.                     end
  652.